Why do I want a version control system?
Placing files you often work with under version control has several benefits:
- Undo changes
- Sometimes when you're editing that file, you'll wish you could go back to the version that actually worked. Now you can!
- Easily carry your work between computers
- If you ever find yourself wondering which computer you left the latest version of X on, version control can help.
- Track the changes made to a file
- With Subversion you can easily get an accurate picture of what you've changed and when.
- Allow a group of people to collaborate effectively
- Version control becomes near essential for any project where several people share responsibility for the same group of files.
Subversion is a free, widely used version control system which is easy to use with your SUCS account.
Creating a repository
$ ssh sucs.org # Connect to the main SUCS server
$ svnadmin create repos
This creates a new empty Subversion repository named "repos"
You may now import an existing directory tree into the repository:
$ svn import {path of stuff to import} {path of repository}
Accessing your repository
Once you have set up a repository, you may access it remotely using a Subversion client. A simple but powerful command-line client exists, in addition to graphical front-ends for most platforms.
Installing a Subversion client
- Linux
- Subversion is included in all major linux distributions, such as Ubuntu, Fedora Core, SuSE and Mandriva. You may use your distribution's standard package management tools to install it.
- Windows
- The command-line client is available for Windows, but you will likely prefer to use a graphical client instead. TortoiseSVN is a Windows shell extension, providing access to version control commands through your right-click context menu.
- Mac OS X
- The easiest way to get SVN for Mac OS X is via fink
You can visit the Subversion packages page for more information.
Check out a "working copy"
In order to view and make changes to files in a Subversion repository, you must first perform a "checkout" operation. This downloads a copy of the files you selected from the repository to your computer, ready to be edited.
The following command will check out a working copy of everything in our repository:
$ svn checkout svn+ssh://{username}@sucs.org/home/member/{username}/repos
Basic Subversion usage
Below are the commands you are likely to use often, to keep your working copy(s) synchronised with your Subversion repository:
After you make changes to a file
$ svn commit -m "Changes made"
Fetching the latest revision
$ svn update
Placing a new file under version control
$ svn add {file(s)}
Dealing with conflicts
When you have more than one edit of one line you will have a conflict. When this happens, you have to manualy merge the two changes. You do this in your editor of choice. Once you've patched up the file you need to tell Subversion$ svn resolved {file(s)}
For more on resolving conflicts see the Subversion Book
Further Reading
If you want to know more about using Subversion, you can take a look at the following links:
- Single-User Subversion
- A slightly more comprehensive tutorial on using Subversion in a single-user environment.
- Version Control with Subversion
- A free book about using Subversion, including a large reference section.